package com.neuedu.his.framework;

import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.util.List;

/**
 * 项目：      his
 * 类名:       BaseService
 * 创建时间：  2020/12/23  8:52
 * 描述 :
 * 作者 :     张金山
 * QQ :     314649444
 * Site:      https://jshand.gitee.io
 */
public interface BaseService<T> {





    public  default PageInfo getPageInfo(HttpServletRequest request){
        PageInfo pageInfo = PageInfo.getPageInfo();

        if(request.getParameter("pageNo") != null && !"".equals(request.getParameter("pageNo"))){
            int pageNo = Integer.parseInt(request.getParameter("pageNo"));
            pageInfo.setPageNo(pageNo);
        }


        if(request.getParameter("pageSize") != null && !"".equals(request.getParameter("pageSize"))){
            int pageSize = Integer.parseInt(request.getParameter("pageSize"));
            pageInfo.setPageSize(pageSize);
        }
        return pageInfo;
    }




    public List<T> queryList(HttpServletRequest request);

    /**
     * 查询集合，分页
     * @return
     */

    public PageInfo queryListByPage( HttpServletRequest request) throws UnsupportedEncodingException;


    public T queryById(Integer id);


    public boolean edit(T disease) ;


    public boolean deleteById(Integer id);


    public boolean save(T disease);


    public boolean batchdel(String[] ids) throws Exception;
}
